var val:string|number
val = 12
console.log(val)
val = "Runoob"
console.log(val)

function disp(name:string|string[]) {
  if (typeof name == "string") {
    console.log(name)
  } else {
    var i
    for (i = 0;i < name.length;i++){
      console.log(name[i])
    }
  }
}

disp("Runoob")
console.log("shuzu")
disp(["Runoob", "Google", "Taobao", "Facebook"])

var arr:number[]|string[]
var i:number
arr = [1, 2, 4]
for (i = 0; i < length; i++){
  console.log(arr[i])
}

arr = ["Runoob", "Google", "Taobao"]
for (i = 0; i < arr.length; i++) {
  console.log(arr[i])
}